

    \filetitle{resample}{Resample from the model implied distribution}{model/resample}

	\paragraph{Syntax}

Input arguments marked with a \texttt{\textasciitilde{}} (tilde) sign
may be omitted.

\begin{verbatim}
Oupt = resample(M,~Inp,Range,~NDraw,~J,...)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{M} {[} model {]} - Solved model object with single
  parameterization.
\item
  \texttt{Inp} {[} struct \textbar{} \emph{empty} {]} - Input data (if
  needed) for the distributions of initial condition and/or empirical
  shocks.
\item
  \texttt{Range} {[} numeric \textbar{} char {]} - Resampling date
  range.
\item
  \texttt{\textasciitilde{}NDraw} {[} numeric \textbar{}
  \emph{\texttt{1}} {]} - Number of draws; may be omitted.
\item
  \texttt{\textasciitilde{}J} {[} struct \textbar{}
  \emph{\texttt{{[}\ {]}}} {]} - Database with user-supplied
  time-varying paths for std deviation, corr coefficients, or medians
  for shocks; \texttt{\textasciitilde{}J} is equivalent to using the
  option \texttt{\textquotesingle{}vary=\textquotesingle{}}, and may be
  omitted.
\end{itemize}

\paragraph{Output arguments}

\begin{itemize}
\tightlist
\item
  \texttt{Outp} {[} struct {]} - Output database with resampled data.
\end{itemize}

\paragraph{Options}

\begin{itemize}
\item
  \texttt{\textquotesingle{}bootstrapMethod=\textquotesingle{}} {[}
  \emph{\texttt{\textquotesingle{}efron\textquotesingle{}}} \textbar{}
  \texttt{\textquotesingle{}wild\textquotesingle{}} \textbar{} numeric
  {]} - Numeric options correspond to block sampling methods. Use a
  positive integer to specify a fixed block length, or a value strictly
  between zero and one to specify random block lengths based on a
  geometric distribution.
\item
  \texttt{\textquotesingle{}deviation=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - Treat input and
  output data as deviations from balanced-growth path.
\item
  \texttt{\textquotesingle{}dtrends=\textquotesingle{}} {[}
  \emph{\texttt{@auto}} \textbar{} \texttt{true} \textbar{}
  \texttt{false} {]} - Add deterministic trends to measurement
  variables.
\item
  \texttt{\textquotesingle{}method=\textquotesingle{}} {[}
  \texttt{\textquotesingle{}bootstrap\textquotesingle{}} \textbar{}
  \emph{\texttt{\textquotesingle{}montecarlo\textquotesingle{}}} {]} -
  Method of randomising shocks and initial condition.
\item
  \texttt{\textquotesingle{}progress=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - Display progress
  bar in the command window.
\item
  \texttt{\textquotesingle{}randomInitCond=\textquotesingle{}} {[}
  \emph{\texttt{true}} \textbar{} \texttt{false} \textbar{} numeric {]}
  - Randomise initial condition; a number means the initial condition
  will be simulated using the specified number of extra pre-sample
  periods.
\item
  \texttt{\textquotesingle{}stateVector=\textquotesingle{}} {[}
  \emph{\texttt{\textquotesingle{}alpha\textquotesingle{}}} \textbar{}
  \texttt{\textquotesingle{}x\textquotesingle{}} {]} - When resampling
  initial condition, use the transformed state vector, \texttt{alpha},
  or the vector of original variables, \texttt{x}; this option is meant
  to guarantee replicability of results.
\item
  \texttt{\textquotesingle{}svdOnly=\textquotesingle{}} {[}
  \texttt{true} \textbar{} \emph{\texttt{false}} {]} - Do not attempt
  Cholesky and only use SVD to factorize the covariance matrix when
  resampling initial condition; only applies when
  \texttt{\textquotesingle{}randomInitCond=\textquotesingle{}\ true}.
\end{itemize}

\paragraph{Description}

When you use wild bootstrap for resampling the initial condition, the
results are based on an assumption that the mean of the initial
condition is the asymptotic mean implied by the model (i.e.~the steady
state).

\paragraph{References}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  Politis, D. N., \& Romano, J. P. (1994). The stationary bootstrap.
  Journal of the American Statistical Association, 89(428), 1303-1313.
\end{enumerate}

\paragraph{Example}


